#pragma once
#include "point.h"
#include "vector.h"
//既是一个矩形，也是一个OOB计算单元
struct Cuboid  {
    float m_halflength{ 0.0f };
    float m_halfwidth{ 0.0f };
    float m_halfheight{ 0.0f };
    //长宽的半径，不是平方
    float m_R2{0.0f};
    //长宽高的半径
    float m_R3{0.0f};

    //用于OOB计算的三个旋转轴(就是垂直于对应面的方向角，例如Axis就是垂直x面的方向角)
    //对于八叉树中的节点，都是沿坐标轴的方向
    Vector m_axis[3] = {
        {1,0,0},
        {0,1,0},
        {0,0,1}
    };
    //长方体的中心点
    Point m_center{ 0.0f,0.0f,0.0f };
    //
    Point UR{ 0.0f,0.0f,0.0f };
    Point DR{ 0.0f,0.0f,0.0f };
    Point UL{ 0.0f,0.0f,0.0f };
    Point DL{ 0.0f,0.0f,0.0f };
    Cuboid() {};
    Cuboid(const float& halflength, const float& halfwidth, const float&halfheight, const Point& center) :
        m_halflength(halflength),
        m_halfwidth(halfwidth),
        m_halfheight(halfheight),
        m_center(center) {
    };
    virtual ~Cuboid(){};

    void setAxe(const float& roation);
    void setVert(const float& rotation);
    float operator[](int i);
    float operator[](int i) const;
};
